import sqlite3 as sqlite
import urllib2

class MyConnection(object):

    def __init__(self,dbname):
        '''
        Constructor
        '''
        self.con = sqlite.connect(dbname)
        
    def __del__(self):
        self.con.close()
    
    def dbcommit(self):
        self.con.commit()
        
    def createindextables(self):
        self.con.execute('create table urllist(url)')

if __name__ == '__main__':
    con = MyConnection('mydb.db')
    c = urllib2.urlopen('http://www.baidu.com');
    contents = c.read().decode('GB2312');
    print contents


